#pragma once

#include <string>

bool checker( std::string const & str, std::string_view const & pattern ) {
    if ( str.size() > 1 && str.size() % pattern.size() == 0 && str.size() != pattern.size() )
    {
        for ( size_t pos = 0; pos < str.size(); pos += pattern.size() )
        {
            if ( pattern != std::string_view{ str.c_str() + pos, pattern.size() } )
            {
                return false;
            }
        }
        return true;
    }
    return false;
}

bool hasSubpattern( std::string const & str = "" ) {
    for ( size_t i = 1; i < str.size(); ++i )
    {
        if ( checker( str, std::string_view{ str.c_str(), i } ) )
            return true;
    }
    return false;
}

bool hasSubpattern2( std::string const & str ) {
    return ( str + str ).find( str, 1 ) != str.length();
}
